fn main() {
    // using if statement
    let x = 5;
    if x < 10 {
        println!("x is less than 10");
    } else if x == 10 {
        println!("x is equal to 10");
    } else {
        println!("x is greater than 10");
    }

    // Rust 有三种循环：loop、while 和 for
    // using if expression
    let y = if x < 10 { 10 } else { 20 }; 
    println!("y = {}", y);

    // using loop statement
    let mut i = 0;
    loop {
        if i == 10 {
            break;
        }
        println!("i = {}", i);
        i += 1;
    }

    // using while statement
    let mut j = 0;
    while j < 10 {
        println!("j = {}", j);
        j += 1;
    }

    // using for statement
    let a = [10, 20, 30, 40, 50];
    for element in a.iter() {
        println!("element = {}", element);
    }

}
